package com.lgb.controller.admin;

import com.lgb.Service.AnnouncementService;
import com.lgb.pojo.Announcement;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.ui.Model;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.servlet.mvc.support.RedirectAttributes;

@Controller
public class AnnouncementController {

    @Autowired
    private AnnouncementService announcementService;

    //接收并保存公告
    @PostMapping("/admin/save_announcement")
    public String save_announcement(Announcement announcement){
        announcementService.saveAnnouncement(announcement);
        return "redirect:/admin/admin_index";
    }
}
